package com.sitech.ibnms.util.charts.fusion;

public class FusionChartCommon {

	public static String randomColor(){
		String color="000000";
		for(int i=0;i<6;i++){
			int s = (int) (Math.random()*10);
			if(i == 0){
				color = String.valueOf(s);
			}else{
				color += String.valueOf(s);
			}
		}
			return color;
	}
	/**
	 * ��ȡdiv��ͼ���ʽ����
	 * @param div_id
	 * @return
	 */
	public static String getScript(ChartParameter parameter){
		String chartScript = "<div id=\""+parameter.getDiv_id()+"\">Your Flash Need Update!</div>\n";
		chartScript += "<script type=\"text/javascript\">\n";
		chartScript += "var myChart = new FusionCharts(\""+parameter.getChartPath()+"\"," +
				" \""+parameter.getChartId()+"\", \""+parameter.getChartWidth()+"\"," +
						" \""+parameter.getChartHeight()+"\", \"0\", \"0\");\n";
		chartScript += "myChart.setDataXML(\"######\");\n";
		chartScript += "myChart.render(\""+parameter.getDiv_id()+"\");\n";
		chartScript += "</script>";
		return chartScript;
	}
	
}
